home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Inne
/
Gry
/
Carnage_Contest
/
scripts
/
CC Original
/
tools
/
The Stake.lua
< prev
next >
Wrap
Text File
|
2010-09-16
|
2KB
|
78 lines
--------------------------------------------------------------------------------
-- Weapon The Stake Of Inquisition
-- Original Carnage Contest Weapon
-- Script by DC, September 2010, www.UnrealSoftware.de
--------------------------------------------------------------------------------
-- Setup Tables
if cc==nil then cc={} end
cc.stake={}
cc.stake.spawn={}
-- Load & Prepare Ressources
cc.stake.gfx_wpn=loadgfx("buildings/thestake.bmp") -- Weapon Image
setmidhandle(cc.stake.gfx_wpn)
cc.stake.sfx_build=loadsfx("buildwood.ogg") -- Build Sound
cc.stake.sfx_church=loadsfx("church.ogg") -- Church Sound
--------------------------------------------------------------------------------
-- Weapon: The Stake Of Inquisition
--------------------------------------------------------------------------------
cc.stake.id=addweapon("cc.stake","The Stake of Inquisition",cc.stake.gfx_wpn,0) -- Add Weapon (0 uses)
function cc.stake.draw() -- Draw
-- HUD Positioning
if weapon_shots==0 then
hudpositioning(pos_build,cc.stake.gfx_wpn,150,0,0,1)
end
end
function cc.stake.attack(attack) -- Attack
if (weapon_shots<=0) and (weapon_position==1) then
-- Use weapon
useweapon(0)
weapon_shots=weapon_shots+1
-- Draw
terrainimage(cc.stake.gfx_wpn,weapon_x,weapon_y)
-- Sound
playsound(cc.stake.sfx_build)
playsound(cc.stake.sfx_church)
-- Firespwaner
id=createprojectile(cc.stake.spawn.id)
projectiles[id]={}
projectiles[id].x=weapon_x
projectiles[id].y=weapon_y
projectiles[id].timer=120
projectiles[id].counter=0
-- End Turn
endturn()
end
end
--------------------------------------------------------------------------------
-- Projectile: Firespawner
--------------------------------------------------------------------------------
cc.stake.spawn.id=addprojectile("cc.stake.spawn") -- Add Projectile
function cc.stake.spawn.draw(id) -- Draw
-- Do Nothing!
end
function cc.stake.spawn.update(id) -- Update
-- Countdown
projectiles[id].timer=projectiles[id].timer-1
if projectiles[id].timer<=0 then
-- Spawn Fire
for i=-1,1 do
createobject(o_fire,projectiles[id].x+i*5,projectiles[id].y+20+math.random(0,3))
end
projectiles[id].counter=projectiles[id].counter+1
projectiles[id].timer=150
if projectiles[id].counter>2 then
-- Free projectile
freeprojectile(id)
end
end
end